$(function () {
	vm.getList();
});

var vm = new Vue({
	el:'#mapp',
	data:{
		title: "社会关注与捐赠",
		bsnGzJzList: {},
		pageParams:{
			limit: "500",
			page: "1"
		}
	},
	methods: {
		saveOrUpdate: function (event) {
			var thisUrl = ajaxServerUrlG("bsnGzJz/saveXmjz");
			$.ajax({
				type: "POST",
			    url: thisUrl,
                contentType: "application/json",
			    data: JSON.stringify(vm.bsnXmjz),
			    success: function(r){
			    	if(r.code === 0){
						alert('操作成功');
					}else{
						alert(r.msg);
					}
				}
			});
		},
		getList: function(){
			var thisUrl = ajaxServerUrlG("bsnGzJz/list");
			$.ajax({
				type: "POST",
			    url: thisUrl,
                contentType: "application/json",
			    data: JSON.stringify(vm.pageParams),
			    success: function(r){
			    	if(r.code === 0){
						vm.bsnGzJzList = r.page.list;
					}else{
						alert(r.msg);
					}
				}
			});
		},
		gotoEdit: function(id) {
			location.href = "msEditGzJz.html?id=" + id + "&title=社会关注与捐赠"; 
		},
		sendDelete: function(id) {
			$.ajax({
				type: "POST",
			    url: ajaxServerUrlG("bsnGzJz/delete"),
	            contentType: "application/json",
			    data: JSON.stringify([id]),
			    success: function(r){
			    	if(r.code === 0){
						vm.getList();
					}else{
						alert(r.msg);
					}
				}
			});
		},
		deleteGzJz: function(id) {
			BootstrapDialog.confirm({
			    title: '确认',
				animate: false,
				message: '您确定要删除吗？',
	            btnCancelLabel: '取消',
	            btnOKLabel: '确定',
	            callback: function(result) {
	                // result will be true if button was click, while it will be false if users close the dialog directly.
	                if(result) {
	                	vm.sendDelete(id);
	                }
	            }
	        });
		}
	}
});